﻿namespace InternetSpiderLib.Scenes.UrlClassifications
{
    /// <summary>
    /// 基础分类器
    /// </summary>
    public abstract class BaseUrlClassification : IUrlClassification
    {
        public int Second { get; set; }

        public UrlClassificationType ClassificationType { get; set; }

        public abstract bool Matching(string url);

        public UrlClassificationInfo ClassificationInfoUrl(string url)
        {
            if (Matching(url))
            {
                return new UrlClassificationInfo
                {
                    ClassificationType = ClassificationType,
                    IntervalSecond = Second,
                };
            }

            return null;
        }
    }
}
